package com.szh.controller;

import com.szh.domain.Product;
import com.szh.service.ProductService;
import com.szh.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 *
 */
@Api(tags = "商品管理")
@CrossOrigin
@RestController
@RequestMapping("/api/product")
public class ProductController {

    @Autowired
    private ProductService productService;

    @ApiOperation("商品列表")
    @GetMapping("/list")
    public R list() {
        List<Product> productList = productService.list();
        return R.ok().data("productList", productList);
    }
}
